<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class LiftPole
 * @package App\Models
 * @version January 4, 2018, 7:17 am UTC
 *
 * @property string vpl_number
 * @property int park_code
 * @property int vpl_type
 * @property timestamp in_time
 * @property timestamp out_time
 * @property int park_duration
 * @property int parking_charge
 * @property string charger
 * @property int status
 */
class LiftPole extends Model
{
    use SoftDeletes;

    public $table = 'lift_poles';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'vpl_number',
        'park_code',
        'vpl_type',
        'in_time',
        'out_time',
        'parking_duration',
        'parking_charge',
        'calc_charge',
        'charger',
        'status',
        'record_id',
        'is_verify',
        'charge_items',
        'in_arm_code',
        'out_arm_code'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'vpl_number' => 'string',
        'charger' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'vpl_number' => 'required'
    ];

    public function getChargeItemsAttribute($value)
    {
        return json_decode(stripslashes($value), true);
    }


}
